package org.pms.servlet;

import com.google.gson.Gson;
import org.pms.entity.User;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/api/showuserinfo.do")
public class ShowUserInfoServlet extends BaseServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        resp.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");

        PrintWriter out = resp.getWriter();

        User user = new User("zs","M",18) ;

        // String json = new Gson().toJson(user) ;
        // ResultDto dto = new ResultDto(200,"",user) ;
        // ResultDto dto = new ResultDto(500,"对不起，您没有权限，请登录！",null) ;

        out.print(new Gson().toJson(successJson(user)));

        out.flush();
        out.close();
    }
}
